<?php

namespace app\admin\model;

use app\common\model\Base;

class Paper extends Base {
  protected $name = 'paper';
  protected $updateTime = FALSE;

  public function initialize() {
    parent::initialize();
  }

  public function getQuestions() {
    $map = ['status' => 0];

    return self::where($map)->select();
  }

  public function getRoomPaper($roomId) {
    if($roomId==0) return [];
    $map = ['room_id' => $roomId];

    return self::where($map)
      ->alias('p')
      ->join('__BASE_USER__ u','u.id=p.uid','left')
      ->field('p.*,u.realname,u.username')
      ->select();
  }

}